import url from './baseUrl.js'

//封装get请求
  let _get=function(url,data){
    var promise = new Promise((resolve,reject)=>{
      let param = data;
      uni.request({
        url: url,
        //header:{}
        data:param,
        method:'get',
        success(res){
          if(res.statusCode == 200){
            resolve(res);
            // console.log("请求成功")
          }else{
            reject(res)
          }
        }
      })
    })
    return promise;
  }
	
	//封装post请求
  let _post=function(url,data){
    let promise = new Promise((resolve,reject)=>{
      let param = data;
      uni.request({
        url:url,
        method:'post',
        //header:{}
        data:param,
        success(res){
          if(res.statusCode == 200){
            resolve(res)
						// console.log(res);
						// console.log("请求成功")
          }else{
            reject(res)
          }
        }
      })
    })
    return promise;
  }
export {_get,_post}